package com.lry.crawlers.information.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lry.crawlers.information.entity.Information;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface InformationMapper extends BaseMapper<Information> {

    @Select("select * from information order by start_time desc limit 0,15")
    List<Information> selectInformations();

    @Update("update information set finish_count = finish_count+1 , all_count = if(all_count>#{allCount} , all_count , #{allCount}) where id=#{id}")
    int upConut(@Param("id")String id, @Param("allCount")String allCount);
    @Update("update information set finish_count = finish_count+#{allCount} , all_count = all_count+#{allCount} where id=#{id}")
    int upConutVideo(@Param("id")String id, @Param("allCount")String allCount);
}
